OnSkillsRegister()
{
	ResetSkillCount();
	API_OnSkillsRegister();
	decl String:buffer[MAX_SKILL_NAME_LENGTH+1], String:buffer2[16];
	for(new i = 0; i < GetSkillCount(); i++)
	{
		Format(buffer, sizeof(buffer), "_%s", SkillShortname[i]);
		Format(buffer2, sizeof(buffer2), "INTEGER(%i)", MAX_SKILL_NAME_LENGTH+1);
		CreateColumn(buffer, buffer2);
	}
}

API_OnSkillsRegister()
{
	Call_StartForward(hFWD_OnSkillsRegister);
	Call_Finish();
}

public Native_RegisterSkill(Handle:plugin, numParams)
{
	if(CountSkills >= MAX_SKILLS)
		return 0;
	
	GetNativeString(1, SkillShortname[CountSkills], MAX_SKILL_NAME_LENGTH);
	for(new i = 0; i < GetSkillCount(); i++)
		if(StrEqual(SkillShortname[CountSkills], SkillShortname[i]))
		{
			LogError("Two identical skills: %s", SkillShortname[CountSkills]);
			Format(SkillShortname[CountSkills], MAX_SKILL_NAME_LENGTH, "");
			return 0;
		}
		
	SkillMaxLevel[CountSkills] = GetConfigValue(SkillShortname[CountSkills], "maxlevel", GetNativeCell(2));
	SkillCost[CountSkills] = GetConfigValue(SkillShortname[CountSkills], "cost", GetNativeCell(3));
	SkilliCost[CountSkills] = GetConfigValue(SkillShortname[CountSkills], "icost", GetNativeCell(4));
	
	new old_count = CountSkills;
	CountSkills++;
	return old_count;
}

public Native_IsValidPlayer(Handle:plugin, numParams)
{	
	new client = GetNativeCell(1);
	new bool:alive = GetNativeCell(2);
	new bool:bots = GetNativeCell(3);
	return IsValidPlayer(client, alive, bots);
}

public Native_GetSkillCount(Handle:plugin, numParams)
{
	return GetSkillCount();
}

public Native_GetSkillShortname(Handle:plugin, numParams)
{
	new skillid = GetNativeCell(1);
	new size = GetNativeCell(3);
	if(skillid > -1 && skillid < GetSkillCount())
	{
		decl String:buffer[MAX_SKILL_NAME_LENGTH];
		GetSkillShortname(skillid, buffer, sizeof(buffer));
		SetNativeString(2, buffer, size);
	}
}

public Native_GetSkillName(Handle:plugin, numParams)
{
	new skillid = GetNativeCell(1);
	if(skillid > -1 && skillid < GetSkillCount())
	{
		new size = GetNativeCell(3);
		new client = GetNativeCell(4);
		
		decl String:buffer[MAX_SKILL_NAME_LENGTH];
		GetSkillName(skillid, buffer, sizeof(buffer), client);
		SetNativeString(2, buffer, size);
	}
}

public Native_GetSkillDesc(Handle:plugin, numParams)
{
	new skillid = GetNativeCell(1);
	if(skillid > -1 && skillid < GetSkillCount())
	{
		new size = GetNativeCell(3);
		new client = GetNativeCell(4);
		
		decl String:buffer[MAX_SKILL_DESC_LENGTH];
		GetSkillDesc(skillid, buffer, sizeof(buffer), client);
		SetNativeString(2, buffer, size);
	}
}

public Native_GetSkillMaxLevel(Handle:plugin, numParams)
{
	new skillid = GetNativeCell(1);
	return GetSkillMaxLevel(skillid);
}

public Native_GetSkillLevel(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new skillid = GetNativeCell(2);
	return GetSkillLevel(client, skillid);
}

public Native_GetClientSkillCost(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new skillid = GetNativeCell(2);
	return GetClientSkillCost(client, skillid);
}

public Native_GetConfigValue(Handle:plugin, numParams)
{
	decl String:key1[16], String:key2[16];
	GetNativeString(1, key1, sizeof(key1));
	GetNativeString(2, key2, sizeof(key2));
	new defvalue = GetNativeCell(3);
	return GetConfigValue(key1, key2, defvalue);
}

public Native_GetConfigValueFloat(Handle:plugin, numParams)
{
	decl String:key1[16], String:key2[16];
	GetNativeString(1, key1, sizeof(key1));
	GetNativeString(2, key2, sizeof(key2));
	new Float:defvalue = GetNativeCell(3);
	return _:GetConfigValueFloat(key1, key2, defvalue);
}

public Native_GetConfigValueString(Handle:plugin, numParams)
{
	decl String:key1[16], String:key2[16], String:value[64], String:defvalue[64];
	GetNativeString(1, key1, sizeof(key1));
	GetNativeString(2, key2, sizeof(key2));
	
	new maxlength = GetNativeCell(4);
	GetNativeString(5, defvalue, maxlength);
	new bool:result = GetConfigValueString(key1, key2, value, maxlength, defvalue);
	SetNativeString(3, value, maxlength);
	return result;
}

public Native_GetLevel(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetLevel(client);
}

public Native_GetXP(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetXP(client);
}

public Native_GetReqXP(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetReqXP(client);
}

public Native_GetCredits(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetCredits(client);
}

public Native_SetLevel(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new level = GetNativeCell(2);
	return SetLevel(client, level);
}

public Native_SetXP(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new xp = GetNativeCell(2);
	return SetXP(client, xp);
}

public Native_SetCredits(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new credits = GetNativeCell(2);
	return SetCredits(client, credits);
}

public Native_SetSkillLevel(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new index = GetNativeCell(2);
	new level = GetNativeCell(3);
	return SetSkillLevel(client, index, level);
}

public Native_SetMaxHP(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new amount = GetNativeCell(2);
	return SetMaxHP(client, amount);
}

public Native_GetMaxHP(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetMaxHP(client);
}

public Native_GetSkillCost(Handle:plugin, numParams)
{
	new skillid = GetNativeCell(1);
	new level = GetNativeCell(2);
	return GetSkillCost(skillid, level);
}

public Native_ResetPlayer(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	ResetPlayer(client);
}

public Native_SetSpeed(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new Float:amount = GetNativeCell(2);
	new bool:variable = GetNativeCell(3);
	return _:SetSpeed(client, amount, variable);
}

public Native_GetSpeed(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return _:GetSpeed(client);
}

public Native_SetMaxSpeed(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new Float:amount = GetNativeCell(2);
	return _:SetMaxSpeed(client, amount);
}

public Native_GetMaxSpeed(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return _:GetMaxSpeed(client);
}

public Native_SetFreeze(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new Float:amount = GetNativeCell(2);
	return _:SetFreeze(client, amount);
}

public Native_GetFreezeTime(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return _:GetFreezeTime(client);
}

public Native_SetColor(Handle:plugin, numParams)
{
	new entity = GetNativeCell(1);
	new red = GetNativeCell(2);
	new green = GetNativeCell(3);
	new blue = GetNativeCell(4);
	new alpha = GetNativeCell(5);
	SetColor(entity, red, green, blue, alpha);
}

public Native_SetSlow(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	new Float:amount = GetNativeCell(2);
	return _:SetSlow(client, amount);
}

public Native_GetSlow(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return _:GetSlow(client);
}

public Native_GetAlpha(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetAlpha(client);
}

public Native_DealDamage(Handle:plugin, numParams)
{
	decl String:weapon[32];
	new victim = GetNativeCell(1);
	new damage = GetNativeCell(2);
	new attacker = GetNativeCell(3);
	new dmg_type = GetNativeCell(4);
	GetNativeString(5, weapon, sizeof(weapon));
	DealDamage(victim, damage, attacker, dmg_type, weapon);
}

public Native_GetActiveWeapon(Handle:plugin, numParams)
{
	new client = GetNativeCell(1);
	return GetActiveWeapon(client);
}